<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('openid')->comment('本ID为【话村】公众号下对应的openid');
            $table->string('unionid')->nullable();
            $table->string('nickname')->nullable();
            $table->string('phone')->nullable();
            $table->string('avatar')->nullable();
            $table->tinyInteger('gender')->default(0)->comment('0：未知，1：男，2：女');
            $table->string('country')->nullable()->comment('国家');
            $table->string('province')->nullable()->comment('省份');
            $table->string('city')->nullable()->comment('城市');
            $table->string('remark')->nullable()->comment('城市');
            $table->string('token')->nullable()->comment('用于其他程序登录');
            $table->string('access_token')->nullable();
            $table->tinyInteger('subscribe_status')->default(1)->comment('当前关注状态');
            $table->string('subscribe_scene')->nullable()->comment('关注途径');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
